package com.yuanfengPlus.basicInfoManage.loginAndAuthentication.utils;

import org.springframework.beans.BeanUtils;

public class BeanCopyUtils {
    public static <T> T copyBean(Object source, Class<T> targetClass) {
        try {
            T target = targetClass.getDeclaredConstructor().newInstance();
            BeanUtils.copyProperties(source, target);
            return target;
        } catch (Exception e) {
            throw new RuntimeException("Bean copy failed", e);
        }
    }
}
